<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="EasyUI/themes/cupertino/easyui.css">
        <link rel="stylesheet" type="text/css" href="EasyUI/themes/icon.css">
    </head>
    <?php
    // Set flag that this is a parent file.
    define('_JEXEC', 1);
    define('DS', DIRECTORY_SEPARATOR);
    define('JPATH_BASE', dirname(dirname(__FILE__)));

    require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
    require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';

    $app = JFactory::getApplication('site');
    $app->initialise();

    $session = JFactory::getSession();
    $session_id = $session->get('user_id', 'empty');

    $IdObra = $_GET["IdObra"];
    $NumOrc = $_GET["IdOrc"];
    ?>
    <body>
        <div style="top: 0px; left: 0px; position: absolute; float: left; width: 725px;">
            <div id="dCadClientes" class="easyui-window" title="Cadastro de Obras"
                 resizable="false" collapsible="false" minimizable="false" maximizable="false" closable="false"
                 draggable="false" shadow="true"
                 style="top: 1px; left: 1px; width:720px; padding: 5px; float: left;">
                <form id="CadObras" action="enviardadosobra.php" onsubmit="return false;">
                    <h3>Informe os dados complementares abaixo:</h3>
                    <input id="IdJoomla" name="IdJoomla" type="hidden" value=<?php echo $session_id; ?> />
                    <input id="IdObra" name="IdObra" type="hidden" value=<?php echo $IdObra; ?> />
                    <table>
                        <tr>
                            <td>Obra:</td>
                            <td><input id="Obra" size="40" maxlength="50" name="Obra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>                        
                        <tr>
                            <td colspan="2" align="center">Endereço da Obra:</td>
                        </tr>
                        <tr>
                            <td>Rua:</td>
                            <td><input id="EndObra" size="80" maxlength="100" name="EndObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Número:</td>
                            <td><input id="NumObra" size="10" maxlength="6" name="NumObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Bairro:</td>
                            <td><input id="BairroObra" size="40" maxlength="50" name="BairroObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Cidade:</td>
                            <td><input id="CidadeObra" size="40" maxlength="50" name="CidadeObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>UF:</td>
                            <td><input id="UFObra" size="5" maxlength="2" name="UFObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>CEP:</td>
                            <td><input id="CEPObra" size="10" maxlength="15" name="CEPObra" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Construtora Responsável:</td>
                            <td><input id="ConsResp" size="50" maxlength="50" name="ConsResp" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Engenheiro Responsável:</td>
                            <td><input id="EngoResp" size="50" maxlength="50" name="EngoResp" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Data Início da Obra:</td>
                            <td><input id="DtIni" name="DtIni" type="text" onblur="NotEmpty(this)" onkeypress="formatar(this, '##/##/####')" />*</td>
                        </tr>
                        <tr>
                            <td>Data Fim da Obra:</td>
                            <td><input id="DtFim" name="DtFim" type="text" onblur="NotEmpty(this)"  onkeypress="formatar(this, '##/##/####')" />*</td>
                        </tr>
                        <tr>
                            <td>Telefone do Responsável:</td>
                            <td><input id="TelResp" size="20" maxlength="20" name="TelResp" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Celular do Responsável:</td>
                            <td><input id="CelResp" size="20" maxlength="20" name="CelResp" type="text" onblur="NotEmpty(this)" />*</td>
                        </tr>
                        <tr>
                            <td>Rádio do Responsável:</td>
                            <td><input id="RadioResp" size="20" maxlength="20" name="RadioResp" type="text" /></td>
                        </tr>
                        <tr>
                            <td>E-Mail do Responsável:</td>
                            <td><input id="EmailResp" size="50" maxlength="50" name="EmailResp" type="text" onblur="checkMail(this);" />*</td>
                        </tr>
                    </table>
                    <br><br><br>
                    <span style="color: red;">É IMPORTANTE DEIXAR CLARO QUE QUALQUER ERRO OU MUDANÇA DAS INFORMAÇÕES<br> SOBRE A OBRA, PODE AFETAR OS VALORES DA ESTIMATIVA ORÇAMENTÁRIA.</span>
                </form>
                <br>
                <?
                $server = $_SERVER['SERVER_NAME'];
                $endereco = $_SERVER ['REQUEST_URI'];
                $url = 'http://' . $server . $endereco;
                $url = substr($url, 0, strrpos($url, '/') + 1);
                ?>

                <div style="text-align: right;">
                    <a class="easyui-linkbutton" href="<? echo $url; ?>index.php">Cancelar</a>
                    <a class="easyui-linkbutton" href="javascript:void(0)" onClick="saveData('<?php echo $url; ?>Orcamento.php', '<?php echo $IdObra; ?>', '<?php echo $NumOrc; ?>');" >Salvar</a>
                </div>
                <div style="text-align: left;">
                    <a class="easyui-linkbutton" href="<? echo $url; ?>index.php">Voltar ao Menu</a>
                </div>
            </div>
        </div>
        <script type="text/javascript" src="JScript/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="EasyUI/locale/easyui-lang-br.js"></script>
        <script type="text/javascript" src="EasyUI/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="JScript/validador.js"></script>
        <script type="text/javascript" src="JScript/js.js"></script>
        <script type="text/javascript" src="JScript/obra.js"></script>
    </body>
</html>